<template>
    <cfg-form-list slot="right">
        <cfg-title v-bind="config.title"></cfg-title>
        <cfg-form :only-read="onlyRead" v-bind="config.section.start" :data="data"></cfg-form>
        <cfg-subtitle :title="'相关数据:'"></cfg-subtitle>
        <cfg-form :only-read="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.relateData" :data="data.relateData"></cfg-form>
        <cfg-subtitle :title="'球磨记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.records" :data="data.records"></cfg-sheet>
        <Button type="primary" long @click="data.records.push({})">加一行</Button>
        <cfg-subtitle :title="'过筛记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.filterRecords" :data="data.filterRecords"></cfg-sheet>
        <Button type="primary" long @click="data.filterRecords.push({})">加一行</Button>
        <cfg-subtitle :title="'备注:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" v-bind="config.section.comments" :data="data"></cfg-form>
    </cfg-form-list>
</template>

<script>
    export default {
        data () {
            return {
                onlyRead: false,
                config: {
                    title: {
                        title: '球 磨 过 筛 原 始 记 录',
                        titleStyle: {},
                        outlineStyle: { marginBottom: '20px' }
                    },
                    section: {
                        start: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            columns: [
                                { title: '表单号:', key: 'formNo', config: { type: 'text' } }
                            ],
                            cols: 2,
                            rules: {}
                        },
                        relateData: {
                            labelWidth: 100,
                            labelPosition: 'right',
                            cols: 4,
                            columns: [
                                { title: '日期:', key: 'date', config: { type: 'date' } },
                                { title: '批次:', key: 'batchNo', config: { type: 'text' } },
                                { title: 'FSSS:', key: 'fsss', config: { type: 'text' } },
                                { title: '破碎机编号:', key: 'breakNo', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        records: {
                            columns: [
                                { title: '球磨时间',
                                  align: 'center',
                                  children: [
                                      { title: '开车',
                                        align: 'center',
                                        children: [
                                            { title: '时', align: 'center', key: 'startHour', config: { type: 'number' } },
                                            { title: '分', align: 'center', key: 'startMinute', config: { type: 'number' } }
                                        ]
                                      },
                                      { title: '停车',
                                        align: 'center',
                                        children: [
                                            { title: '时', align: 'center', key: 'stopHour', config: { type: 'number' } },
                                            { title: '分', align: 'center', key: 'stopMinute', config: { type: 'number' } }
                                        ]
                                      }
                                  ]
                                },
                                { title: '操作者',
                                  align: 'center',
                                  children: [
                                      { title: '进料',
                                        align: 'center',
                                        key: 'feedPerson',
                                        config: { type: 'text' }
                                      },
                                      { title: '卸料',
                                        align: 'center',
                                        key: 'unloadPerson',
                                        config: { type: 'text' }
                                      }
                                  ]
                                }
                            ]
                        },
                        filterRecords: {
                            columns: [
                                { title: '过筛',
                                  align: 'center',
                                  children: [
                                      { title: '筛号',
                                        align: 'center',
                                        key: 'sieveNo',
                                        config: { type: 'text' }
                                      },
                                      { title: '重量<br/>（kg)',
                                        align: 'center',
                                        key: 'weight',
                                        config: { type: 'number' }
                                      },
                                      { title: '操作者',
                                        align: 'center',
                                        key: 'person',
                                        config: { type: 'text' }
                                      }
                                  ]
                                },
                                { title: '清机',
                                  align: 'center',
                                  key: 'clear',
                                  config: { type: 'select', options: [{ label: '是', value: '1' }, { label: '否', value: '2' }] }
                                }
                            ]
                        },
                        comments: {
                            labelWidth: 0,
                            labelPosition: 'right',
                            cols: 1,
                            columns: [
                                { title: '', key: 'comments', config: { type: 'textarea' } }
                            ],
                            rules: {}
                        },
                        end: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            columns: [
                                { title: '通知者:', key: 'notifier', config: { type: 'text' } },
                                { title: '审核:', key: 'auditor', config: { type: 'text' } },
                                { title: '日期:', key: 'date', config: { type: 'date' } }
                            ],
                            cols: 3,
                            rules: {}
                        }
                    }
                }
            };
        },
        props: {
            data: {
                default: () => {
                    return {
                        formNo: '',
                        relateData: {
                            date: '',
                            batchNo: '',
                            fsss: '',
                            breakNo: ''
                        },
                        records: [
                            {
                                startHour: 0,
                                startMinute: 0,
                                stopHour: 0,
                                stopMinute: 0
                            }
                        ],
                        filterRecords: [
                            {
                                sieveNo: '',
                                weight: 0,
                                person: ''
                            }
                        ],
                        comments: '',
                        notifier: '',
                        auditor: '',
                        date: '2022-12-06'
                    }
                }
            }
        }
    };
</script>
<style scoped lang="scss"></style>
